home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
edit
/
me_cd25.zip
/
ME2MUTT.ZIP
/
ABBREV.MUT
next >
Wrap
Text File
|
1992-11-09
|
2KB
|
71 lines
;; abbrev.mut : abbrevation mode
;; C Durland 4/88 Public Domain
;; Junk code
;; Note: This is a very limited abbrev mode.
(include spoint.mut)
(const abbrev-buffer "*ABBREVs*")
(defun
stuff-text (array byte text 1) HIDDEN
{
(int n z)
(for (n 0) (!= 0 (z (text n)))(+= n 1)(exe-key z))
}
lookup-abbrev (string name) HIDDEN
{
(bool s)
(save-point)
(switch-to-buffer abbrev-buffer)(beginning-of-buffer)
(if (re-search-forward (concat '^' name ' ' ))
{ (looking-at '.*') (s TRUE) }
(s FALSE)
)
(restore-point)(msg "")
s
}
expand-abbrev
{
(bool s)
(if (and (!= 1 (current-column))
{ (previous-character)(s (looking-at '\w'))(next-character) s } )
{
(previous-word)
(if (and (looking-at '\w+')(lookup-abbrev (get-matched '&')))
{ (cut-word)(stuff-text (get-matched '&')) }
(next-word)
)
})
}
select-abbrev-file
{
(string abbrev-file)
(abbrev-file (ask "What abbrev file do you want to load? "))
(kill-buffer abbrev-buffer)(save-point)
(switch-to-buffer abbrev-buffer)(read-file abbrev-file)
(buffer-flags -1 BFGone)
(restore-point)
}
key-pressed-hook (int key)
{
(switch key
0x20 () ; space
0x2C () ; comma
0x14D () ; Return
0x21 () ; !
0x2E () ; period
0x3F () ; ?
default (done) ; key does not trigger abbrev expansion
)
(exe-key 0x1031) ; S-1
}
)
(bind-local-key "expand-abbrev" "S-1")